// pages/home/home.js
let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    datalist: [],
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    imglist: {
      "学一": 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQfpvZ2WCuIRrlObVgygYFpgmSOo4UP6kS3KEXQSnoGhkTH0XBESgMIb4pVrxjLNE0mW4dIMX4UYGswjDqdPU0xY!/b&bo=yADIAAAAAAADByI!&rf=viewer_4&t=5',
      "学二": 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQTH0PnxpLw2U8uPmK*d6E2DaP0XlxP*CFRNa.DB3XNeplvWMybfIJkejRJiZotibe5USxRvWljUd2g5NxirVn9M!/b&bo=yADIAAAAAAADByI!&rf=viewer_4&t=5',
      '学三': 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQcG0ef5CV5sfdIkiLaCMZqLm58njW9W976g53UIvl5QZdgZBkw2DlNh7MzOe.vFF4NlWLAd3OfuttdRVGPQQQYk!/b&bo=yADIAAAAAAADByI!&rf=viewer_4&t=5',
      '学四': 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQTL5IPhd4yTri7AXWYUWEdnWupWwRKGoXplK2vIEvfKMqrQ2dWkaHmJgYlRXx3M7TkIZA**sDppr4PPBCGni9.Y!/b&bo=yADIAAAAAAADByI!&rf=viewer_4&t=5',
      '教一': 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQRzmXouCGWtaamKEAC4waoocJPMTGcU6hdWRRTYosK9IA7jDmkrMzGHwFXbIgAt4Q4QH4U*ha.n.PSQzEUPM2bM!/b&bo=yADIAAAAAAADFzI!&rf=viewer_4&t=5',
      '教二': 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQbHLry8XW12pIBXx3Dg2Qu6erLIEgSTPZdp1YMN7PlD*if9EKYWLQbSMkh4oe2NmUIISirSnTZTWU0fGjhARQUg!/b&bo=yADIAAAAAAADByI!&rf=viewer_4&t=5',
      '教四': 'http://m.qpic.cn/psc?/931299a0-15dc-449d-9b43-71d170fd1e7a/zkoezU7GGNbZGOF.DPhgQeH3x200Vdg1T9PGhIzh2akvxqv*RjEnDpcJJ0eZqKtWk6mvQ5ZgN5Wj7Cz8w.kobsg8Stge.tM5z1XldstSlX0!/b&bo=.gDIAAAAAAADBxA!&rf=viewer_4&t=5'
    }
  },
  bindGetUserInfo(e) {
    console.log(e.detail.userInfo)
  },
  info: function() {
    wx.navigateTo({
      url: '/pages/info/info',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

    //获取title和desc
    const db = wx.cloud.database();
    db.collection('c1_comment')
      .get().then(res => {
        console.log("获取成功", res);
        this.setData({
          datalist: res.data
        })
      })
      .catch(res => {
        console.log("获取失败", res)
      })
  },

  gotoDetail: function(event) {
    console.log("event:", event)
    let ee = event.currentTarget.dataset;
    wx.navigateTo({
      url: '/pages/detail/detail?id=' + ee.item._id,
    })
    console.log(event.currentTarget.dataset.item)
  }


})